#ifndef CHARTCLASS_H
#define CHARTCLASS_H
#include<QChart>
#include <QWidget>
#include <QChartView>
#include <QLineSeries>
#include <QBarSeries>
#include <memory>
#include <QtCharts/QSplineSeries>

using namespace QtCharts;
class Chart: public QWidget{
public:
    Chart(QWidget *parent = nullptr);
    virtual ~Chart(){}
    virtual  QChartView* DisPlay()=0;
    virtual void setChartData(int x,int y)=0;
 protected:
    std::shared_ptr<QChart> m_grch;//图表
    std::shared_ptr<QChartView> m_view;//视图
};
class SplineChar : public Chart
{
    public:
    SplineChar(QWidget *parent=nullptr);
   virtual ~SplineChar(){}
    QChartView* DisPlay();
    void setChartData(int x,int y);
private:

    std::shared_ptr<QSplineSeries> m_series;//柱状图
};


class BarChart :public Chart
{
public:
    BarChart(QWidget *parent=nullptr);
    virtual ~BarChart(){}
     QChartView* DisPlay();
private:

    std::shared_ptr<QBarSeries> m_series;//柱状图
};


class LineChar :public Chart
{
public:
    LineChar(QWidget *parent=nullptr);
    virtual ~LineChar(){}
    QChartView* DisPlay();
    void setChartData(int x,int y);
private:
   std::shared_ptr<QLineSeries> m_series;//折线图

};

#endif // CHARTCLASS_H
